import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)

export default new Router({
  mode: 'history',
  base: process.env.BASE_URL,
  routes: [
    { path:'/',redirect:'/index'},
    {
      path: '/index',
      name: 'index',
      component: () => import('./components/ele homepage/Index.vue'),
      redirect:'/homepage',
      children:[
        // 首页
        {
          path: '/homepage',
          name: 'homepage',
          component: () => import('./components/ele homepage/HomePage.vue'),
        },
        // 推荐
        {
          path: '/recommend',
          name: 'recommend',
          component: () => import('./components/ele homepage/Recommend.vue'),
        },
        // 订单
        {
          path: '/orderform',
          name: 'orderform',
          component: () => import('./components/ele homepage/OrderForm.vue'),
        },
        // 我的
        {
          path: '/my',
          name: 'my',
          component: () => import('./components/ele homepage/My.vue'),
        },
      ]
    },
    // 商家店铺主页
    {
      path: '/shopHome',
      name: 'shopHome',
      component: () => import('./components/shop homepage/shopHome.vue'),
      redirect:"/commodity",
      children:[
        // 商品
        {
          path: '/commodity',
          name: 'commodity',
          component: () => import('./components/shop homepage/Commodity.vue'),
        },
        // 评价
        {
          path: '/evaluate',
          name: 'evaluate',
          component: () => import('./components/shop homepage/Evaluate.vue'),
        },
        // 商家
        {
          path: '/merchant',
          name: 'merchant',
          component: () => import('./components/shop homepage/Merchant.vue'),
        },
      ]
    },
    {
      path:"/details",
      name:'details',
      component: () => import('./components/shop homepage/Details.vue'),
    }
  ]
})
